package com.sg.dto.integration.app;

import com.sg.common.dto.BaseDto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
import java.util.Objects;

/**
 * @desc SubCycleDto
 * @使用场景
 */
@Data
public class SubCycleDto extends BaseDto implements Serializable {

    /**
     * 周期ID
     */
    @ApiModelProperty("周期ID")
    private String cycleId;

    /**
     * 周期名称
     */
    @ApiModelProperty("周期名称")
    private String cycleStandardName;

    /**
     * 周期开始时间
     */
    @ApiModelProperty("周期开始时间")
    private Date cycleStartTime;

    /**
     * 周期结束时间
     */
    @ApiModelProperty("周期结束时间")
    private Date cycleEndTime;

    /**
     * 被评对象目标周期ID
     */
    @NotNull(message = "被评对象目标周期ID不能为空")
    @ApiModelProperty("被评对象目标周期ID")
    private String evaObjTargetCycleId;

    /**
     * 上级被评对象目标周期标识
     */
    @ApiModelProperty("上级被评对象目标周期标识")
    private String parentEvaObjTargetCycleId;

    /**
     * 目标周期简称
     */
    @ApiModelProperty("目标周期简称")
    private String cyclelAlias;

    /**
     * 关联目标内容ID
     */
    @ApiModelProperty("关联目标内容ID")
    private String targetCycleContentId;

    /**
     * 关联目标内容类型编码 TARGET:目标 TARGET_CATEGORY:目标分类 OBJECTIVE:指标
     */
    @ApiModelProperty("关联目标内容类型编码")
    private String targetCycleContentTypeCode;

    /**
     * 成果汇报开始时间
     */
    @NotNull(message = "成果汇报开始时间不能为空")
    @ApiModelProperty("成果汇报开始时间")
    private Date targetActualStartTime;

    /**
     * 成果汇报结束时间
     */
    @NotNull(message = "成果汇报结束时间不能为空")
    @ApiModelProperty("成果汇报结束时间")
    private Date targetActualEndtTime;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;
        SubCycleDto that = (SubCycleDto) o;
        return (
                cycleId == that.cycleId &&
                        cycleStandardName == that.cycleStandardName &&
                        cycleStartTime == that.cycleStartTime &&
                        cycleEndTime == that.cycleEndTime &&
                        evaObjTargetCycleId == that.evaObjTargetCycleId &&
                        parentEvaObjTargetCycleId == that.parentEvaObjTargetCycleId &&
                        cyclelAlias == that.cyclelAlias &&
                        targetCycleContentId == that.targetCycleContentId &&
                        targetCycleContentTypeCode == that.targetCycleContentTypeCode &&
                        targetActualStartTime == that.targetActualStartTime &&
                        targetActualEndtTime == that.targetActualEndtTime
        );
    }

    @Override
    public int hashCode() {
        return Objects.hash(
                super.hashCode(),
                cycleId,
                cycleStandardName,
                cycleStartTime,
                cycleEndTime,
                evaObjTargetCycleId,
                parentEvaObjTargetCycleId,
                cyclelAlias,
                targetCycleContentId,
                targetCycleContentTypeCode,
                targetActualStartTime,
                targetActualEndtTime
        );
    }

}
